package com.bella.springcloud.controller;/**
 * @program: cloud2022
 * @description:
 * @packagename: com.bella.springcloud.controller
 * @author: Bella白
 * @date: 2022-09-04 17:38
 **/


import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Component;

/**
 * @author: bella白
 * @Title: ReceiveMessageListener
 * @ProjectName: cloud2022
 * @Description:消费者
 * @date: 2022/9/4 17:38
 */
@Component
@EnableBinding(Sink.class)
public class ReceiveMessageListener {
    @Value("${server.port}")
    private String serverPort;
    @StreamListener(Sink.INPUT)
    public void input(Message<String> message){
        System.out.println("port:" + serverPort + "\t接受：" + message.getPayload());
    }
}
